/**
 *
 */
import Util;
import OpenApi;
import OpenApiUtil;
import EndpointUtil;

extends OpenApi;


init(config: OpenApi.Config){
  super(config);
  @endpointRule = '';
  
  checkConfig(config);
  @endpoint = getEndpoint('retailadvqa', @regionId, @endpointRule, @network, @suffix, @endpointMap, @endpoint);
}

function getEndpoint(productId: string, regionId: string, endpointRule: string, network: string, suffix: string, endpointMap: map[string]string, endpoint: string) throws: string{
  if (!Util.empty(endpoint)) {
    return endpoint;
  }
  
  if (!Util.isUnset(endpointMap) && !Util.empty(endpointMap[regionId])) {
    return endpointMap[regionId];
  }
  return EndpointUtil.getEndpointRules(productId, regionId, endpointRule, network, suffix);
}

model AddMemberBasicInfoRequest {
  body?: {
    area?: string(name='Area'),
    avatar?: string(name='Avatar'),
    birthday?: string(name='Birthday', example='2022-09-08'),
    channels?: [ 
      {
        appId?: string(name='AppId'),
        channelCode?: string(name='ChannelCode', description='This parameter is required.'),
        channelOpenId?: string(name='ChannelOpenId'),
        channelUnionId?: string(name='ChannelUnionId'),
        scene?: string(name='Scene'),
      }
    ](name='Channels', description='This parameter is required.'),
    city?: string(name='City'),
    country?: string(name='Country'),
    email?: string(name='Email'),
    extra?: string(name='Extra', example='""'),
    gmtCreate?: string(name='GmtCreate'),
    memberName?: string(name='MemberName'),
    memberNickName?: string(name='MemberNickName'),
    mixMobile?: string(name='MixMobile'),
    mobile?: string(name='Mobile', example='17716699087'),
    openMerchantId?: string(name='OpenMerchantId', description='This parameter is required.'),
    platFormType?: string(name='PlatFormType', description='This parameter is required.'),
    province?: string(name='Province'),
    sex?: string(name='Sex'),
  }(name='body'),
}

model AddMemberBasicInfoShrinkRequest {
  bodyShrink?: string(name='body'),
}

model AddMemberBasicInfoResponseBody = {
  errorCode?: string(name='ErrorCode', example='Lydaas.QuickMember.SystemError'),
  errorMessage?: string(name='ErrorMessage'),
  outerMemberId?: string(name='OuterMemberId', example='WMS_36606164948078_23218019'),
  requestId?: string(name='RequestId', example='1DEFC4F1-AF11-5A3C-93B9-2880768DA218'),
  success?: boolean(name='Success', example='true'),
}

model AddMemberBasicInfoResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: AddMemberBasicInfoResponseBody(name='body'),
}

/**
 * @summary 开放平台同步会员基础信息
 *
 * @param tmpReq AddMemberBasicInfoRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return AddMemberBasicInfoResponse
 */
async function addMemberBasicInfoWithOptions(tmpReq: AddMemberBasicInfoRequest, runtime: Util.RuntimeOptions): AddMemberBasicInfoResponse {
  Util.validateModel(tmpReq);
  var request = new AddMemberBasicInfoShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.body)) {
    request.bodyShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.body, 'body', 'json');
  }
  var query = {};
  if (!Util.isUnset(request.bodyShrink)) {
    query['body'] = request.bodyShrink;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'AddMemberBasicInfo',
    version = '2023-04-17',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 开放平台同步会员基础信息
 *
 * @param request AddMemberBasicInfoRequest
 * @return AddMemberBasicInfoResponse
 */
async function addMemberBasicInfo(request: AddMemberBasicInfoRequest): AddMemberBasicInfoResponse {
  var runtime = new Util.RuntimeOptions{};
  return addMemberBasicInfoWithOptions(request, runtime);
}

model BatchSaveOrderPopRequest {
  orders?: [ 
    {
      adjustFee?: string(name='AdjustFee'),
      buyerArea?: string(name='BuyerArea'),
      buyerRate?: string(name='BuyerRate'),
      channelCode?: string(name='ChannelCode', description='This parameter is required.', example='doudian'),
      channelOpenId?: string(name='ChannelOpenId', description='This parameter is required.', example='1699b2b974d444e3aa489f96457ef204'),
      commissionFee?: string(name='CommissionFee'),
      consignTime?: string(name='ConsignTime'),
      discountFee?: string(name='DiscountFee'),
      endTime?: string(name='EndTime'),
      feature?: string(name='Feature'),
      openMerchantId?: string(name='OpenMerchantId', description='This parameter is required.', example='testOpenMerchantId'),
      openOrderId?: string(name='OpenOrderId', description='This parameter is required.', example='testOpenOrderId'),
      orderCreateTime?: string(name='OrderCreateTime', description='This parameter is required.', example='2023-12-20 12:12:12'),
      orderPayment?: string(name='OrderPayment', description='This parameter is required.', example='10000'),
      payTime?: string(name='PayTime'),
      platformType?: string(name='PlatformType', description='This parameter is required.', example='DOUDIAN'),
      pointFee?: string(name='PointFee'),
      postFee?: string(name='PostFee'),
      realPointFee?: string(name='RealPointFee'),
      receiverCity?: string(name='ReceiverCity'),
      receiverState?: string(name='ReceiverState'),
      sellerFlag?: string(name='SellerFlag'),
      sellerRate?: string(name='SellerRate'),
      shopId?: string(name='ShopId', description='This parameter is required.', example='testShopId'),
      sid?: string(name='Sid'),
      status?: string(name='Status', description='This parameter is required.', example='TRADE_FINISHED'),
      subOrderModelList?: [ 
        {
          adjustFee?: string(name='AdjustFee'),
          buyerArea?: string(name='BuyerArea'),
          buyerRate?: string(name='BuyerRate'),
          cid?: string(name='Cid'),
          consignTime?: string(name='ConsignTime'),
          discountFee?: string(name='DiscountFee'),
          feature?: string(name='Feature'),
          itemMealId?: string(name='ItemMealId'),
          itemMealName?: string(name='ItemMealName'),
          openSubOrderId?: string(name='OpenSubOrderId', description='This parameter is required.', example='testSubOrderId'),
          orderPayment?: string(name='OrderPayment', description='This parameter is required.', example='10000'),
          orderTag?: string(name='OrderTag'),
          outProductId?: string(name='OutProductId'),
          payment?: string(name='Payment'),
          productAmount?: string(name='ProductAmount', description='This parameter is required.', example='1'),
          productId?: string(name='ProductId'),
          productName?: string(name='ProductName'),
          receiverCity?: string(name='ReceiverCity'),
          receiverState?: string(name='ReceiverState'),
          refundId?: string(name='RefundId'),
          refundStatus?: string(name='RefundStatus'),
          sellerFlag?: string(name='SellerFlag'),
          sellerRate?: string(name='SellerRate'),
          status?: string(name='Status', description='This parameter is required.', example='TRADE_FINISHED'),
          totalFee?: string(name='TotalFee', description='This parameter is required.', example='10000'),
          tradeFrom?: string(name='TradeFrom'),
        }
      ](name='SubOrderModelList', description='This parameter is required.'),
      totalFee?: string(name='TotalFee', description='This parameter is required.', example='10000'),
      buyerOpenUid?: string(name='buyerOpenUid'),
      tradeFrom?: string(name='tradeFrom'),
    }
  ](name='Orders'),
}

model BatchSaveOrderPopShrinkRequest {
  ordersShrink?: string(name='Orders'),
}

model BatchSaveOrderPopResponseBody = {
  errorCode?: string(name='ErrorCode', example='testErrorCode'),
  errorMessage?: string(name='ErrorMessage', example='testErrorMessage'),
  httpStatusCode?: string(name='HttpStatusCode', example='200/400...'),
  requestId?: string(name='RequestId', description='Id of the request', example='testRequestId'),
  success?: boolean(name='Success', example='true'),
}

model BatchSaveOrderPopResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: BatchSaveOrderPopResponseBody(name='body'),
}

/**
 * @summary 批量保存订单信息
 *
 * @param tmpReq BatchSaveOrderPopRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return BatchSaveOrderPopResponse
 */
async function batchSaveOrderPopWithOptions(tmpReq: BatchSaveOrderPopRequest, runtime: Util.RuntimeOptions): BatchSaveOrderPopResponse {
  Util.validateModel(tmpReq);
  var request = new BatchSaveOrderPopShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.orders)) {
    request.ordersShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.orders, 'Orders', 'json');
  }
  var query = {};
  if (!Util.isUnset(request.ordersShrink)) {
    query['Orders'] = request.ordersShrink;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'BatchSaveOrderPop',
    version = '2023-04-17',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 批量保存订单信息
 *
 * @param request BatchSaveOrderPopRequest
 * @return BatchSaveOrderPopResponse
 */
async function batchSaveOrderPop(request: BatchSaveOrderPopRequest): BatchSaveOrderPopResponse {
  var runtime = new Util.RuntimeOptions{};
  return batchSaveOrderPopWithOptions(request, runtime);
}

model CalculateMemberLevelRequest {
  body?: {
    currentGrade?: int32(name='CurrentGrade', description='This parameter is required.', example='1'),
    currentGradeName?: string(name='CurrentGradeName', description='This parameter is required.'),
    memberId?: string(name='MemberId', description='This parameter is required.', example='4000006009418358'),
    openMerchantId?: string(name='OpenMerchantId', description='This parameter is required.', example='1230094'),
    platformType?: string(name='PlatformType', description='This parameter is required.', example='TAOBAO'),
    score?: string(name='Score', example='0'),
    serialNo?: string(name='SerialNo', description='This parameter is required.', example='0235b7f20a11de9e2bf4c3494b6d998d'),
  }(name='Body'),
}

model CalculateMemberLevelShrinkRequest {
  bodyShrink?: string(name='Body'),
}

model CalculateMemberLevelResponseBody = {
  errorCode?: string(name='ErrorCode', example='Lydaas.QuickMember.SystemError'),
  errorMessage?: string(name='ErrorMessage'),
  grade?: string(name='Grade', example='1'),
  httpStatusCode?: string(name='HttpStatusCode', example='200'),
  message?: string(name='Message'),
  outerMemberId?: string(name='OuterMemberId', example='6062f9067f170700a2e7ef5a'),
  requestId?: string(name='RequestId', example='1DEFC4F1-AF11-5A3C-93B9-2880768DA218'),
  success?: boolean(name='Success', example='true'),
}

model CalculateMemberLevelResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CalculateMemberLevelResponseBody(name='body'),
}

/**
 * @summary 会员等级初始化
 *
 * @param tmpReq CalculateMemberLevelRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CalculateMemberLevelResponse
 */
async function calculateMemberLevelWithOptions(tmpReq: CalculateMemberLevelRequest, runtime: Util.RuntimeOptions): CalculateMemberLevelResponse {
  Util.validateModel(tmpReq);
  var request = new CalculateMemberLevelShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.body)) {
    request.bodyShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.body, 'Body', 'json');
  }
  var query = {};
  if (!Util.isUnset(request.bodyShrink)) {
    query['Body'] = request.bodyShrink;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CalculateMemberLevel',
    version = '2023-04-17',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 会员等级初始化
 *
 * @param request CalculateMemberLevelRequest
 * @return CalculateMemberLevelResponse
 */
async function calculateMemberLevel(request: CalculateMemberLevelRequest): CalculateMemberLevelResponse {
  var runtime = new Util.RuntimeOptions{};
  return calculateMemberLevelWithOptions(request, runtime);
}

model EditMemberBasicInfoRequest {
  body?: {
    area?: string(name='Area'),
    avatar?: string(name='Avatar', example='xxx.jpg'),
    birthday?: string(name='Birthday', example='2024-06-20'),
    city?: string(name='City'),
    country?: string(name='Country'),
    email?: string(name='Email', example='xxx.com'),
    memberName?: string(name='MemberName'),
    memberNickName?: string(name='MemberNickName', example='xxxx'),
    mobile?: string(name='Mobile', description='This parameter is required.', example='***********'),
    openMerchantId?: string(name='OpenMerchantId', description='This parameter is required.', example='1230094'),
    platformType?: string(name='PlatformType', description='This parameter is required.', example='TAOBAO'),
    province?: string(name='Province'),
    sex?: string(name='Sex'),
  }(name='Body'),
}

model EditMemberBasicInfoShrinkRequest {
  bodyShrink?: string(name='Body'),
}

model EditMemberBasicInfoResponseBody = {
  errorCode?: string(name='ErrorCode', example='Lydaas.QuickMember.SystemError'),
  errorMessage?: string(name='ErrorMessage'),
  httpStatusCode?: string(name='HttpStatusCode', example='200'),
  message?: string(name='Message', example='success'),
  requestId?: string(name='RequestId', example='1DEFC4F1-AF11-5A3C-93B9-2880768DA218'),
  success?: boolean(name='Success', example='true'),
}

model EditMemberBasicInfoResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: EditMemberBasicInfoResponseBody(name='body'),
}

/**
 * @summary 会员信息编辑API
 *
 * @param tmpReq EditMemberBasicInfoRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return EditMemberBasicInfoResponse
 */
async function editMemberBasicInfoWithOptions(tmpReq: EditMemberBasicInfoRequest, runtime: Util.RuntimeOptions): EditMemberBasicInfoResponse {
  Util.validateModel(tmpReq);
  var request = new EditMemberBasicInfoShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.body)) {
    request.bodyShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.body, 'Body', 'json');
  }
  var query = {};
  if (!Util.isUnset(request.bodyShrink)) {
    query['Body'] = request.bodyShrink;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'EditMemberBasicInfo',
    version = '2023-04-17',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 会员信息编辑API
 *
 * @param request EditMemberBasicInfoRequest
 * @return EditMemberBasicInfoResponse
 */
async function editMemberBasicInfo(request: EditMemberBasicInfoRequest): EditMemberBasicInfoResponse {
  var runtime = new Util.RuntimeOptions{};
  return editMemberBasicInfoWithOptions(request, runtime);
}

model MemberAccountDetailPageQueryRequest {
  body?: {
    accountType?: int32(name='AccountType', description='This parameter is required.', example='20'),
    endTime?: string(name='EndTime', example='2011-09-02 00:00:00'),
    openMerchantId?: string(name='OpenMerchantId', description='This parameter is required.', example='750cff00c3e0996d220ac2861dafdfadsf'),
    outerMemberId?: string(name='OuterMemberId', description='This parameter is required.', example='WMS_36606164948078_23218019'),
    page?: int32(name='Page', example='1'),
    pageSize?: int32(name='PageSize', example='10'),
    platFormType?: string(name='PlatFormType', description='This parameter is required.'),
    startTime?: string(name='StartTime', example='2011-09-01 00:00:00'),
  }(name='body'),
}

model MemberAccountDetailPageQueryShrinkRequest {
  bodyShrink?: string(name='body'),
}

model MemberAccountDetailPageQueryResponseBody = {
  data?: [ 
    {
      accountBalance?: string(name='AccountBalance', example='100'),
      accountType?: int32(name='AccountType', example='20'),
      activityType?: string(name='ActivityType', description='This parameter is required.'),
      channelCode?: string(name='ChannelCode'),
      detailValue?: string(name='DetailValue', example='20'),
      extra?: string(name='Extra', description='This parameter is required.', example='...'),
      gmtCreate?: string(name='GmtCreate', description='This parameter is required.'),
      gmtModified?: string(name='GmtModified', description='This parameter is required.'),
      openMerchantId?: string(name='OpenMerchantId', example='750cff00c3e0996d220ac2861dafdfadsf'),
      operateType?: string(name='OperateType', example='1'),
      outerMemberId?: string(name='OuterMemberId', example='MEMBER_fc498a12edd84dafd'),
      remark?: string(name='Remark', example='...'),
    }
  ](name='Data'),
  errorCode?: string(name='ErrorCode', example='Lydaas.QuickMember.SystemError'),
  errorMessage?: string(name='ErrorMessage'),
  requestId?: string(name='RequestId', description='Id of the request', example='1DEFC4F1-AF11-5A3C-93B9-2880768DA218'),
  success?: string(name='Success', description='This parameter is required.', example='true'),
  totalCount?: int32(name='TotalCount', example='5000'),
}

model MemberAccountDetailPageQueryResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: MemberAccountDetailPageQueryResponseBody(name='body'),
}

/**
 * @summary 开放平台会员积分明细查询
 *
 * @param tmpReq MemberAccountDetailPageQueryRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return MemberAccountDetailPageQueryResponse
 */
async function memberAccountDetailPageQueryWithOptions(tmpReq: MemberAccountDetailPageQueryRequest, runtime: Util.RuntimeOptions): MemberAccountDetailPageQueryResponse {
  Util.validateModel(tmpReq);
  var request = new MemberAccountDetailPageQueryShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.body)) {
    request.bodyShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.body, 'body', 'json');
  }
  var query = {};
  if (!Util.isUnset(request.bodyShrink)) {
    query['body'] = request.bodyShrink;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'MemberAccountDetailPageQuery',
    version = '2023-04-17',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 开放平台会员积分明细查询
 *
 * @param request MemberAccountDetailPageQueryRequest
 * @return MemberAccountDetailPageQueryResponse
 */
async function memberAccountDetailPageQuery(request: MemberAccountDetailPageQueryRequest): MemberAccountDetailPageQueryResponse {
  var runtime = new Util.RuntimeOptions{};
  return memberAccountDetailPageQueryWithOptions(request, runtime);
}

model MemberPointChangeRequest {
  body?: {
    accountType?: string(name='AccountType', description='This parameter is required.'),
    channelCode?: string(name='ChannelCode'),
    extra?: string(name='Extra', example='""'),
    openMerchantId?: string(name='OpenMerchantId', description='This parameter is required.', example='750cff00c3e0996d220ac2861dafdfadsf'),
    operateType?: string(name='OperateType', description='This parameter is required.', example='1'),
    outerMemberId?: string(name='OuterMemberId', description='This parameter is required.', example='WMS_36606164948078_23218019'),
    platFormType?: string(name='PlatFormType', description='This parameter is required.'),
    quantity?: string(name='Quantity', description='This parameter is required.', example='1'),
    serialNo?: string(name='SerialNo', description='This parameter is required.', example='4LJDNJH9JUX48L41'),
  }(name='body'),
}

model MemberPointChangeShrinkRequest {
  bodyShrink?: string(name='body'),
}

model MemberPointChangeResponseBody = {
  accountBalance?: string(name='AccountBalance'),
  errorCode?: string(name='ErrorCode', example='Lydaas.QuickMember.SystemError'),
  errorMessage?: string(name='ErrorMessage'),
  levelName?: string(name='LevelName', description='This parameter is required.', example='12'),
  requestId?: string(name='RequestId', example='B2CD5682-12C0-51A7-82FC-1D36091CADAD'),
  success?: string(name='Success', example='true'),
}

model MemberPointChangeResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: MemberPointChangeResponseBody(name='body'),
}

/**
 * @summary 会员积分变更
 *
 * @param tmpReq MemberPointChangeRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return MemberPointChangeResponse
 */
async function memberPointChangeWithOptions(tmpReq: MemberPointChangeRequest, runtime: Util.RuntimeOptions): MemberPointChangeResponse {
  Util.validateModel(tmpReq);
  var request = new MemberPointChangeShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.body)) {
    request.bodyShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.body, 'body', 'json');
  }
  var query = {};
  if (!Util.isUnset(request.bodyShrink)) {
    query['body'] = request.bodyShrink;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'MemberPointChange',
    version = '2023-04-17',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 会员积分变更
 *
 * @param request MemberPointChangeRequest
 * @return MemberPointChangeResponse
 */
async function memberPointChange(request: MemberPointChangeRequest): MemberPointChangeResponse {
  var runtime = new Util.RuntimeOptions{};
  return memberPointChangeWithOptions(request, runtime);
}

model QueryMemberBasicInfoRequest {
  body?: {
    channelCode?: string(name='ChannelCode'),
    channelOpenId?: string(name='ChannelOpenId'),
    mobile?: string(name='Mobile', example='18888889999'),
    openMerchantId?: string(name='OpenMerchantId', description='This parameter is required.', example='750cff00c3e0996d220ac2861dafdfadsf'),
    outerMemberId?: string(name='OuterMemberId', example='WMS_36606164948078_23218019'),
    platFormType?: string(name='PlatFormType', description='This parameter is required.'),
    type?: string(name='Type', description='This parameter is required.', example='1'),
  }(name='body'),
}

model QueryMemberBasicInfoShrinkRequest {
  bodyShrink?: string(name='body'),
}

model QueryMemberBasicInfoResponseBody = {
  data?: {
    area?: string(name='Area'),
    avatar?: string(name='Avatar', description='This parameter is required.'),
    birthday?: string(name='Birthday'),
    city?: string(name='City'),
    country?: string(name='Country'),
    email?: string(name='Email'),
    extra?: string(name='Extra'),
    levelName?: string(name='LevelName'),
    levelNum?: string(name='LevelNum'),
    memberName?: string(name='MemberName'),
    memberNickName?: string(name='MemberNickName'),
    mobile?: string(name='Mobile'),
    nearExpiredScore?: string(name='NearExpiredScore'),
    openMerchantId?: string(name='OpenMerchantId'),
    outerMemberId?: string(name='OuterMemberId'),
    points?: string(name='Points'),
    province?: string(name='Province'),
    score?: string(name='Score'),
    sex?: string(name='Sex'),
  }(name='Data'),
  errorCode?: string(name='ErrorCode', example='Lydaas.QuickMember.SystemError'),
  errorMessage?: string(name='ErrorMessage'),
  requestId?: string(name='RequestId', example='1DEFC4F1-AF11-5A3C-93B9-2880768DA218'),
  success?: boolean(name='Success', example='true'),
}

model QueryMemberBasicInfoResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: QueryMemberBasicInfoResponseBody(name='body'),
}

/**
 * @summary 查询会员基础信息
 *
 * @param tmpReq QueryMemberBasicInfoRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return QueryMemberBasicInfoResponse
 */
async function queryMemberBasicInfoWithOptions(tmpReq: QueryMemberBasicInfoRequest, runtime: Util.RuntimeOptions): QueryMemberBasicInfoResponse {
  Util.validateModel(tmpReq);
  var request = new QueryMemberBasicInfoShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.body)) {
    request.bodyShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.body, 'body', 'json');
  }
  var query = {};
  if (!Util.isUnset(request.bodyShrink)) {
    query['body'] = request.bodyShrink;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'QueryMemberBasicInfo',
    version = '2023-04-17',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 查询会员基础信息
 *
 * @param request QueryMemberBasicInfoRequest
 * @return QueryMemberBasicInfoResponse
 */
async function queryMemberBasicInfo(request: QueryMemberBasicInfoRequest): QueryMemberBasicInfoResponse {
  var runtime = new Util.RuntimeOptions{};
  return queryMemberBasicInfoWithOptions(request, runtime);
}

model SyncCardInfoRequest {
  body?: {
    buyerId?: string(name='BuyerId', example='1236437142867408'),
    extra?: string(name='Extra', example='""'),
    gifters?: {
      headerImg?: string(name='HeaderImg', example='https://xxx/2.jpg'),
      id?: string(name='Id', example='1000030820003'),
      nickname?: string(name='Nickname'),
      openId?: string(name='OpenId', description='openId', example='82ace612cd377134d597e32e91562caf'),
      phone?: string(name='Phone', example='13277778888'),
    }(name='Gifters'),
    occurredAt?: string(name='OccurredAt', example='2023-05-12 00:00:00'),
    openMerchantId?: string(name='OpenMerchantId', example='750cff00c3e0996d220ac2861dafdfadsf'),
    orderId?: string(name='OrderId', example='223332140970453'),
    presentDetail?: [ 
      {
        count?: long(name='Count'),
        itemId?: string(name='ItemId'),
        name?: string(name='Name'),
        price?: double(name='Price'),
        skuId?: string(name='SkuId'),
      }
    ](name='PresentDetail'),
    receivedAt?: string(name='ReceivedAt', example='2023-05-12 00:00:00'),
    recipient?: {
      headerImg?: string(name='HeaderImg', example='https://xxx/1.jpg'),
      id?: string(name='Id', example='1000030855004'),
      nickname?: string(name='Nickname'),
      openId?: string(name='OpenId', description='openId', example='1179ead68b3833fea61a802ddb1dd3ac'),
      phone?: string(name='Phone', example='18899998888'),
    }(name='Recipient'),
    status?: string(name='Status', example='success'),
    theme?: string(name='Theme'),
    transferId?: string(name='TransferId', example='3eecd2b8a6f946ca'),
    transferredAt?: string(name='TransferredAt', example='2023-05-12 00:00:00'),
  }(name='body'),
}

model SyncCardInfoShrinkRequest {
  bodyShrink?: string(name='body'),
}

model SyncCardInfoResponseBody = {
  errorCode?: string(name='ErrorCode', example='Lydaas.QuickMember.SystemError'),
  errorMessage?: string(name='ErrorMessage'),
  httpStatusCode?: string(name='HttpStatusCode', example='200'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId', example='1DEFC4F1-AF11-5A3C-93B9-2880768DA218'),
  success?: string(name='Success', example='true'),
}

model SyncCardInfoResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: SyncCardInfoResponseBody(name='body'),
}

/**
 * @summary 卡券信息同步
 *
 * @param tmpReq SyncCardInfoRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return SyncCardInfoResponse
 */
async function syncCardInfoWithOptions(tmpReq: SyncCardInfoRequest, runtime: Util.RuntimeOptions): SyncCardInfoResponse {
  Util.validateModel(tmpReq);
  var request = new SyncCardInfoShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.body)) {
    request.bodyShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.body, 'body', 'json');
  }
  var query = {};
  if (!Util.isUnset(request.bodyShrink)) {
    query['body'] = request.bodyShrink;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'SyncCardInfo',
    version = '2023-04-17',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 卡券信息同步
 *
 * @param request SyncCardInfoRequest
 * @return SyncCardInfoResponse
 */
async function syncCardInfo(request: SyncCardInfoRequest): SyncCardInfoResponse {
  var runtime = new Util.RuntimeOptions{};
  return syncCardInfoWithOptions(request, runtime);
}

model SyncMemberBehaviorInfoRequest {
  body?: {
    actionDuration?: string(name='ActionDuration'),
    actionEndDate?: string(name='ActionEndDate'),
    actionResult?: boolean(name='ActionResult'),
    actionStartDate?: string(name='ActionStartDate'),
    actionSubType?: string(name='ActionSubType'),
    actionType?: string(name='ActionType', description='This parameter is required.'),
    extra?: string(name='Extra'),
    openMerchantId?: string(name='OpenMerchantId', description='This parameter is required.'),
    outerMemberId?: string(name='OuterMemberId', description='This parameter is required.'),
    platFormType?: string(name='PlatFormType', description='This parameter is required.'),
  }(name='body'),
}

model SyncMemberBehaviorInfoShrinkRequest {
  bodyShrink?: string(name='body'),
}

model SyncMemberBehaviorInfoResponseBody = {
  errorCode?: string(name='ErrorCode', example='Lydaas.QuickMember.SystemError'),
  errorMessage?: string(name='ErrorMessage'),
  requestId?: string(name='RequestId', example='1DEFC4F1-AF11-5A3C-93B9-2880768DA218'),
  success?: boolean(name='Success', example='true'),
}

model SyncMemberBehaviorInfoResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: SyncMemberBehaviorInfoResponseBody(name='body'),
}

/**
 * @summary 开放平台会员行为信息同步
 *
 * @param tmpReq SyncMemberBehaviorInfoRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return SyncMemberBehaviorInfoResponse
 */
async function syncMemberBehaviorInfoWithOptions(tmpReq: SyncMemberBehaviorInfoRequest, runtime: Util.RuntimeOptions): SyncMemberBehaviorInfoResponse {
  Util.validateModel(tmpReq);
  var request = new SyncMemberBehaviorInfoShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.body)) {
    request.bodyShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.body, 'body', 'json');
  }
  var query = {};
  if (!Util.isUnset(request.bodyShrink)) {
    query['body'] = request.bodyShrink;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'SyncMemberBehaviorInfo',
    version = '2023-04-17',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 开放平台会员行为信息同步
 *
 * @param request SyncMemberBehaviorInfoRequest
 * @return SyncMemberBehaviorInfoResponse
 */
async function syncMemberBehaviorInfo(request: SyncMemberBehaviorInfoRequest): SyncMemberBehaviorInfoResponse {
  var runtime = new Util.RuntimeOptions{};
  return syncMemberBehaviorInfoWithOptions(request, runtime);
}

